home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvtool17.zip / TVTOOLS.DOC < prev    next >
Text File  |  1993-10-25  |  12KB  |  376 lines

  1. /***
  2.     Module      :   TVTOOLS
  3.  
  4.     Description :   Various tools and addings for TV 
  5.  
  6.  
  7.  
  8.  
  9.   New operators:    TMenuItem  = TMenuItem + TMenuItem
  10.   =============     TMenuItem += TMenuItem
  11.                     TSItem  = TSItem + TSItem
  12.                     TSItem += TSItem
  13.                     TSubMenu += TSubMenu
  14.                     TSubMenu += TMenuItem
  15.                     TStatusDef += TStatusDef
  16.                     TStatusDef += TStatusItem
  17.  
  18.  
  19.   General List:
  20.   ============
  21.  
  22.   TGenCollection:  Same as TStringCollection
  23.                       TGenCollection( ccIndex = 0, ccIndex = 0 );
  24.  
  25.        but with two output functions:
  26.            char *getData( ccIndex );  // to return the data
  27.            char *getText( ccIndex );  // to display text in a viewer
  28.        By default, getData() calls getText().
  29.  
  30.        These functions have to be used in place of TStringCollection ones
  31.        and can be overloaded:        
  32.  
  33.            ccIndex indexOf( char *item );       // data index
  34.            ccIndex indexOfText( char *item );   // text index
  35.            int getCount();                      // returns number of items
  36.            int getTextLength();                 // returns maximum length of text
  37.            int compare( void *, void * );       // function to compare to items    
  38.            void *firstThat( ccTestFunc Test, void *arg );     // search
  39.            void *firstTextThat( ccTestFunc Test, void *arg ); // search
  40.  
  41.        All  these  virtual  functions  are  designed  to  work  as  is  with
  42.        TStringCollection lists. The functions you need to  overload  to  use
  43.        another list mechanism are: 
  44.  
  45.            getData(), getText(), getCount()  
  46.  
  47.        The other ones use these three ones.
  48.        Default compare() is case-insensitive (also éàÅ,...  are  treated  as
  49.        normal letters).
  50.               
  51.  
  52.  
  53.  
  54.   ComboBox:
  55.   ========
  56.  
  57.   TComboBox:  Pop-up box with a list viewer.
  58.               Must be linked with a TInputLine (or TStaticInputLine)  and  a
  59.               TGenCollection.
  60.  
  61.               When pressing characters, the first list item  matching  these
  62.               characters is focused. If a non matching character is pressed,
  63.               a buzzer sound is output. 
  64.  
  65.               Enter or double-click is used to select an item.
  66.               The corresponding data will so be given to the TInputLine.
  67.  
  68.               TComboBox( const TRect&, TInputLine *, TGenCollection * );
  69.               TComboBox( TInputLine *, TGenCollection * ); // Right of line
  70.  
  71.  
  72.  
  73.   New Input fields:
  74.   ================
  75.  
  76.   TInput1Line( x, y, len )
  77.  
  78.   T1StaticText( x, y, string ): same as TStaticText
  79.  
  80.   TStaticTextf( const TRect& bounds, const char *fmt, ... )
  81.   TStaticTextf( const ushort x, const ushort y, const char *fmt, ... )
  82.    same as TStaticText but allows same syntax as printf()
  83.  
  84.  
  85.   T1Label( x, y, string, link )
  86.  
  87.  
  88.   TInputKey:    Same as TInputLine, except invalid if empty
  89.  
  90.                 TInputKey( const TRect&, int len );
  91.                 TInputKey( int x, int y, int len );
  92.  
  93.  
  94.   TInputPasswd: Same as TInputLine, but display only '*' 
  95.  
  96.                 TInputPasswd( const TRect&, int len );
  97.                 TInputPasswd( int x, int y, int len );
  98.                                      
  99.  
  100.   TInputRegExp: Same as TInputLine, but filter input to be in  a  'set'  and
  101.                 check result to match the regular  expression  'regexp'.  If
  102.                 UPPER or LOWER is given as last  parameter,  all  characters
  103.                 are translate into upper/lowercase (also éàÅ,...).
  104.  
  105.                 If an invalid  character  is  pressed,  a  buzzer  sound  is
  106.                 output. If input does not match the  regular  expression,  a
  107.                 messageBox is output at valid() time. This  message  may  be
  108.                 replaced or disabled (0). 
  109.  
  110.                 char *invMsg = " \n\03Invalid entry !";
  111.  
  112.                 'set' and 'regexp' comply with UNIX-grep regular expressions;
  113.                 ex: set = "0-9a-z+-*/" or "^0-9"
  114.                     regexp = "[0-9]*.[a-zA-Z]*..*"
  115.                 'set' and 'regexp' can be nul (0 or not given).
  116.  
  117.                 TInputRegExp( const TRect&, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  118.                 TInputRegExp( int x, int y, int len [, char *set [, char *regexp [, UPPER/LOWER]]] );
  119.  
  120.  
  121.  
  122.  
  123.   TInputInt:    Accepts only valid numeric input (int) between Min and Max.
  124.                 If a wrong character is pressed, a buzzer sound is output.
  125.  
  126.                 TInputInt( const TRect&, int len = 7, int min = -MAXINT, int max = MAXINT );
  127.                 TInputInt( int x, int y , int len = 7, int min = -MAXINT, int max = MAXINT );
  128.  
  129.  
  130.   TInputLong:   Accepts only valid numeric input (long) between Min and Max.
  131.                 If a wrong character is pressed, a buzzer sound is output.       
  132.  
  133.                 TInputLong( const TRect&, int len = 12, long min = -MAXLONG, long max = MAXLONG );
  134.                 TInputLong( int x, int y , int len = 12, long min = -MAXLONG, long max = MAXLONG );
  135.  
  136.  
  137.   TInputDouble: Accepts only valid numeric input between Min and Max.
  138.                 If a wrong character is pressed, a buzzer sound is output.       
  139.  
  140.                 TInputDouble( const TRect&, int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  141.                 TInputDouble( int x, int y , int len = 15, double min = -MAXDOUBLE, double max = MAXDOUBLE );
  142.  
  143.  
  144.   TInputHexa:   Accepts only valid hexadecimal string input.
  145.                 If a wrong character is pressed, a buzzer sound is output.
  146.  
  147.                 TInputHexa( const TRect&, int len );
  148.                 TInputHexa( int x, int y , int len );
  149.  
  150.  
  151.   TInputDate:   Accepts only valid date input (or empty line).
  152.                 If a wrong character is pressed, a buzzer sound is output. 
  153.  
  154.                 TInputDate( const TRect& );
  155.                 TInputDate( int x, int y );
  156.  
  157.  
  158.   TInputCalcul: Accepts a calculation string.
  159.                 If a wrong character is pressed, a buzzer sound is output.
  160.  
  161.                 TInputCalcul( const TRect&, int len );
  162.                 TInputCalcul( int x, int y, int len );
  163.  
  164.  
  165.   TStaticInputLine:
  166.                 Same as TInputLine, but input must match a TGenCollection list.
  167.  
  168.                 When pressing characters, the first list item matching these
  169.                 characters is displayed. If  a  non  matching  character  is
  170.                 pressed, a buzzer sound is output. The left and right arrows
  171.                 are used to cycle through items, Home & End to go to first &
  172.                 last item (and the matching buffer is reset).
  173.  
  174.                 TStaticInputLine( TRect&, int len, TGenCollection *list );
  175.                 TStaticInputLine( int x, int y, int len, TGenCollection *list );
  176.  
  177.  
  178.  
  179.   New InputBox:
  180.   ============
  181.  
  182.   ushort inputPasswdBox( const char *Title, const char *aLabel, char *s, uchar limit );
  183.   ushort inputPasswdBoxRect( const TRect &bounds,
  184.                              const char *Title,
  185.                              const char *aLabel,
  186.                              char *s,
  187.                              uchar limit );
  188.  
  189.  
  190.   Misc:
  191.   ====
  192.  
  193.   ushort execDialog( TWindow *d, void *data );
  194.  
  195.        - Execute a dialog box and returns entered values.
  196.        - Fields are pre-loaded with data values.
  197.        - If data is NULL, nothing is pre-loaded nor returned.
  198.        - If the dialog is cancelled, data is not modified.
  199.        - Dialog is destroyed before exiting.
  200.        - Return:  command (cmCancel, cmYes,...)
  201.  
  202.  
  203.   void putCommand( ushort What, ushort Command );
  204.  
  205.        - Put an event containing {What, Command}
  206.  
  207.  
  208.   void saveMouseState( void );
  209.   void restoreMouseState( void );
  210.  
  211.        - Save/Restore mouse state (position)
  212.  
  213.  
  214.   appSystem( command );
  215.  
  216.        - Suspend critical error handler,
  217.        - clears screen,
  218.        - perform a system call,
  219.        - resume critical error handler,
  220.        - redraws screen.
  221.        - If current drive is A: or B: and is not ready (not inserted  or  not
  222.          formatted), ask to insert a